//
//  ActivityCell.m
//  ErWa
//
//  Created by 赵颜彬 on 16/3/10.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ActivityCell.h"

@implementation ActivityCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 标题
        self.titleLabel = [[UILabel alloc] init];
        //        _titleLabel.textAlignment = NSTextAlignmentCenter;
        _titleLabel.font = [UIFont systemFontOfSize:19];
        [self.contentView addSubview:_titleLabel];
        // 图片
        self.imgView = [[UIImageView alloc] init];
        [self.contentView addSubview:_imgView];
        self.imgView.clipsToBounds = YES;
        self.imgView.layer.cornerRadius = 20;
        //地址
        self.addressLabel = [[UILabel alloc] init];
        _addressLabel.numberOfLines = 0;
        _addressLabel.font = [UIFont systemFontOfSize:15];
        
        [self.contentView addSubview:_addressLabel];
        //日期
        self.dateLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_dateLabel];
        _dateLabel.font = [UIFont systemFontOfSize:15];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    //标题位置
    self.titleLabel.frame = CGRectMake(10, 10, self.contentView.frame.size.width - 20, self.contentView.frame.size.height / 5);
    // 图片位置
    self.imgView.frame = CGRectMake(10, _titleLabel.frame.origin.y + _titleLabel.frame.size.height + 10, self.contentView.frame.size.height - _titleLabel.frame.size.height - 22, self.contentView.frame.size.height - _titleLabel.frame.size.height - 22);
    // 日期位置
    self.dateLabel.frame = CGRectMake(_imgView.frame.origin.x + _imgView.frame.size.width + 5, _imgView.frame.origin.y, self.contentView.frame.size.width - _imgView.frame.size.width - 25, self.contentView.frame.size.height / 5);
    // 地址位置
    self.addressLabel.frame = CGRectMake(_dateLabel.frame.origin.x, _dateLabel.frame.origin.y + _dateLabel.frame.size.height + 5, _dateLabel.frame.size.width, _imgView.frame.size.height - _dateLabel.frame.size.height - 5);
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
